package problems;

import java.math.BigInteger;

public class Euler016 extends AbstractEuler {

	@Override
	public Number calculate() {
		Long result = 0L;
		
		StringBuffer twoPower1000inBinary = new StringBuffer("1");
		for (int i = 0; i < 1000; i++) {
			twoPower1000inBinary.append("0");
		}
		BigInteger twoPower1000 = new BigInteger(twoPower1000inBinary.toString(), 2);
		String s = twoPower1000.toString(10);
		for (int i = 0; i < s.length(); i++) {
			result += new Integer(s.substring(i, i+1));
		}
		return result;
	}

	@Override
	protected Number getCorrectAnswer() {
		return 1366L;
	}

}
